<div class="content_wrapper">
  <div class="content_wrapper_inner">
      <?php echo validation_errors(); ?>
      <?php echo form_open('bookflight'); ?><br>
	  <div class="showBox">
      <div style="float:left"><h5><?php echo $this->lang->line('profile_information');?></h5></div>
      <div id="reqFields"><?php echo $this->lang->line('required_fields');?></div><br>     
      <table id="pax_table" border="0" cellpadding="0" cellspacing="0">
      	<script>
      			$(function() {
				   $("#phone_format").mask("0(999) 999-9999");
				});
      			$(function() {
 				   $("#tcno_format").mask("99999999999");
 				});
      			$(function() {
  				   $("#tcno_format_inv").mask("99999999999");
  				});
      			$(function() {
 				   $("#miles_format").mask("TK999999999");
 				});
      		</script>
      	<tr>
      		<td><?php echo $this->lang->line('phone');?>(*)</td>
      		<td style="width:185px"><input maxlength="20" size="20" type="text" name="pax_phone" id="phone_format" value="<?php echo set_value('pax_phone'); ?>"></td>
  			<td><?php echo $this->lang->line('e_mail');?></td>
  			<td><input maxlength="20" size="20" type="text" name="pax_email" value="<?php echo set_value('pax_email'); ?>"></td>
      	</tr>
      		<td><?php echo $this->lang->line('tc_identity');?></td>
      		<td><input maxlength="11" size="20" type="text" name="pax_tc_number" id="tcno_format" value="<?php echo set_value('pax_tc_number'); ?>"></td>
      		<td><?php echo $this->lang->line('corporate_pin');?></td>
  			<td><input maxlength="11" size="20" type="text" name="pax_corporate_pin" value="<?php echo set_value('pax_corporate_pin'); ?>"></td>
      	<tr>
      	
      	</tr>
      </table>
      <br/>
      <table id="pax_table" border="0" cellpadding="0" cellspacing="0">
		<thead>
			<tr style="font-weight:bold">
				<td><?php echo $this->lang->line('pax');?></td>
        		<td><?php echo $this->lang->line('sex');?>(*)</td>
				<td><?php echo $this->lang->line('name');?>(*)</td>
				<td><?php echo $this->lang->line('surname');?>(*)</td>
				<td><?php echo $this->lang->line('miles_smiles');?></td>
				<td><?php echo $this->lang->line('wheel_chair');?></td>
			</tr>
		</thead>
		<tbody>
			<?php
			$offset=0;
			for ($i = 0; $i < $this->session->userdata('search_form_adults'); $i++,$offset++) {?>
			<tr>
				<td><?php echo $this->lang->line('adult');?><input type="hidden" name="pax_type[]" value="1"></td>
				<td>
	       		    <select name="pax_sex[]">
						<option value="M" <?php echo set_select('pax_sex[]', 'M',TRUE,$offset); ?>>Bay</option>
						<option value="W" <?php echo set_select('pax_sex[]', 'W',FALSE,$offset); ?>>Bayan</option>
					</select>
				</td>
        		<td><input maxlength="20" size="15" type="text" name="pax_name[]" value="<?php echo set_value('pax_name[]'); ?>"></td>
				<td><input maxlength="20" size="15" type="text" name="pax_surname[]" value="<?php echo set_value('pax_surname[]'); ?>"></td>
				<td><input maxlength="11" size="12" type="text" name="pax_miles_number[]" id="miles_format" value="<?php echo set_value('pax_miles_number[]'); ?>"></td>
				<td>
  					<select width="110" style="width: 110px" name="pax_wheel_chair[]">
						<option value="0" <?php echo set_select('pax_wheel_chair[]', '0',TRUE,$offset); ?>><?php echo $this->lang->line('pax_wchr_0');?></option>
						<option value="1" <?php echo set_select('pax_wheel_chair[]', '1',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_1');?></option>
						<option value="2" <?php echo set_select('pax_wheel_chair[]', '2',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_2');?></option>
						<option value="3" <?php echo set_select('pax_wheel_chair[]', '3',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_3');?></option>
					</select>
  				</td>
			</tr>
			<?}?>
			<?php for ($i = 0; $i < $this->session->userdata('search_form_elders'); $i++,$offset++) {?>
			<tr>
				<td><?php echo $this->lang->line('elder');?><input type="hidden" name="pax_type[]" value="2"></td>
        		<td>
	        		<select name="pax_sex[]">
						<option value="M" <?php echo set_select('pax_sex[]', 'M',TRUE,$offset); ?>>Bay</option>
						<option value="W" <?php echo set_select('pax_sex[]', 'W',FALSE,$offset); ?>>Bayan</option>
					</select>
				</td>
				<td><input maxlength="20" size="15" type="text" name="pax_name[]" value="<?php echo set_value('pax_name[]'); ?>"></td>
				<td><input maxlength="20" size="15" type="text" name="pax_surname[]" value="<?php echo set_value('pax_surname[]'); ?>"></td>
				<td><input maxlength="11" size="12" type="text" name="pax_miles_number[]"  id="miles_format" value="<?php echo set_value('pax_miles_number[]'); ?>"></td>
				<td>
  					<select width="110" style="width: 110px" name="pax_wheel_chair[]">
						<option value="0" <?php echo set_select('pax_wheel_chair[]', '0',TRUE,$offset); ?>><?php echo $this->lang->line('pax_wchr_0');?></option>
						<option value="1" <?php echo set_select('pax_wheel_chair[]', '1',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_1');?></option>
						<option value="2" <?php echo set_select('pax_wheel_chair[]', '2',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_2');?></option>
						<option value="3" <?php echo set_select('pax_wheel_chair[]', '3',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_3');?></option>
					</select>
  				</td>
			</tr>
			<?}?>
			<?php for ($i = 0; $i < $this->session->userdata('search_form_military'); $i++,$offset++) {?>
			<tr>
				<td><?php echo $this->lang->line('military');?><input type="hidden" name="pax_type[]" value="3"></td>
				<td>
					<select name="pax_sex[]">
						<option value="M" <?php echo set_select('pax_sex[]', 'M',TRUE,$offset); ?>>Bay</option>
						<option value="W" <?php echo set_select('pax_sex[]', 'W',FALSE,$offset); ?>>Bayan</option>
					</select>
				</td>
      			<td><input maxlength="20" size="15" type="text" name="pax_name[]" value="<?php echo set_value('pax_name[]'); ?>"></td>
				<td><input maxlength="20" size="15" type="text" name="pax_surname[]" value="<?php echo set_value('pax_surname[]'); ?>"></td>
				<td><input maxlength="11" size="12" type="text" name="pax_miles_number[]"  id="miles_format" value="<?php echo set_value('pax_miles_number[]'); ?>"></td>
				<td>
  					<select width="110" style="width: 110px" name="pax_wheel_chair[]">
						<option value="0" <?php echo set_select('pax_wheel_chair[]', '0',TRUE,$offset); ?>><?php echo $this->lang->line('pax_wchr_0');?></option>
						<option value="1" <?php echo set_select('pax_wheel_chair[]', '1',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_1');?></option>
						<option value="2" <?php echo set_select('pax_wheel_chair[]', '2',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_2');?></option>
						<option value="3" <?php echo set_select('pax_wheel_chair[]', '3',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_3');?></option>
					</select>
  				</td>
			</tr>
			<?}?>
			<?php for ($i = 0; $i < $this->session->userdata('search_form_students'); $i++,$offset++) {?>
			<tr>
				<td><?php echo $this->lang->line('student');?><input type="hidden" name="pax_type[]" value="3"></td>
				<td>
					<select name="pax_sex[]">
						<option value="M" <?php echo set_select('pax_sex[]', 'M',TRUE,$offset); ?>>Bay</option>
						<option value="W" <?php echo set_select('pax_sex[]', 'W',FALSE,$offset); ?>>Bayan</option>
					</select>
				</td>
      			<td><input maxlength="20" size="15" type="text" name="pax_name[]" value="<?php echo set_value('pax_name[]'); ?>"></td>
				<td><input maxlength="20" size="15" type="text" name="pax_surname[]" value="<?php echo set_value('pax_surname[]'); ?>"></td>
				<td><input maxlength="11" size="12" type="text" name="pax_miles_number[]"  id="miles_format" value="<?php echo set_value('pax_miles_number[]'); ?>"></td>
				<td>
  					<select width="110" style="width: 110px" name="pax_wheel_chair[]">
						<option value="0" <?php echo set_select('pax_wheel_chair[]', '0',TRUE,$offset); ?>><?php echo $this->lang->line('pax_wchr_0');?></option>
						<option value="1" <?php echo set_select('pax_wheel_chair[]', '1',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_1');?></option>
						<option value="2" <?php echo set_select('pax_wheel_chair[]', '2',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_2');?></option>
						<option value="3" <?php echo set_select('pax_wheel_chair[]', '3',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_3');?></option>
					</select>
  				</td>
			</tr>
			<?}?>
			<?php for ($i = 0; $i < $this->session->userdata('search_form_children'); $i++,$offset++) {?>
			<tr>
				<td><?php echo $this->lang->line('child');?><input type="hidden" name="pax_type[]" value="4"></td>
				<td>
					<select name="pax_sex[]">
						<option value="M" <?php echo set_select('pax_sex[]', 'M',TRUE,$offset); ?>>Bay</option>
						<option value="W" <?php echo set_select('pax_sex[]', 'W',FALSE,$offset); ?>>Bayan</option>
					</select>
				</td>
        		<td><input maxlength="20" size="15" type="text" name="pax_name[]" value="<?php echo set_value('pax_name[]'); ?>"></td>
				<td><input maxlength="20" size="15" type="text" name="pax_surname[]" value="<?php echo set_value('pax_surname[]'); ?>"></td>
				<td><input maxlength="11" size="12" type="text" name="pax_miles_number[]"  id="miles_format" value="<?php echo set_value('pax_miles_number[]'); ?>"></td>
				<td>
  					<select width="110" style="width: 110px" name="pax_wheel_chair[]">
						<option value="0" <?php echo set_select('pax_wheel_chair[]', '0',TRUE,$offset); ?>><?php echo $this->lang->line('pax_wchr_0');?></option>
						<option value="1" <?php echo set_select('pax_wheel_chair[]', '1',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_1');?></option>
						<option value="2" <?php echo set_select('pax_wheel_chair[]', '2',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_2');?></option>
						<option value="3" <?php echo set_select('pax_wheel_chair[]', '3',FALSE,$offset); ?>><?php echo $this->lang->line('pax_wchr_3');?></option>
					</select>
  				</td>
			</tr>
			<?}?>
			<?php for ($i = 0; $i < $this->session->userdata('search_form_infants'); $i++,$offset++) {?>
			<script>
              	$(function() {
              		$("#datepickerIN<?=$i?>").datepicker( $.datepicker.regional[ "tr" ] );
              		$("#datepickerIN<?=$i?>").datepicker({ dateFormat: 'dd.mm.yy', yearRange: 'c-2:c-0' ,changeYear: true});
              	});
          	</script>
			<tr>
				<td><?php echo $this->lang->line('infant');?></td>
				<td>
					<select name="pax_sex[]">
						<option value="M" <?php echo set_select('pax_sex[]', 'M',TRUE,$offset); ?>>Bay</option>
						<option value="W" <?php echo set_select('pax_sex[]', 'W',FALSE,$offset); ?>>Bayan</option>
					</select>
				</td>
        		<td><input maxlength="20" size="15" type="text" name="pax_name[]" value="<?php echo set_value('pax_name[]'); ?>"></td>
				<td><input maxlength="20" size="15" type="text" name="pax_surname[]" value="<?php echo set_value('pax_surname[]'); ?>"></td>
				<td style="color: red">Bebek doğum günü:</td>
				<td><input id="datepickerIN<?=$i?>" size="12" type="text" name="pax_dob[]" value="<?php echo set_value('pax_dob[]'); ?>">(*)</td>
				
			</tr>
			<?}?>
		</tbody>
      </table></div>
      <br>
	  <div class="showBox">
      <h5><?php echo $this->lang->line('receipt_information');?> <?php echo $this->lang->line('required_for_ticket');?></h5>
      <div>
        <div style="float:left;"><br>
          <table id="receipt_table"  border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><?php echo $this->lang->line('adress');?>(*)</td>
              <td style="width:178px"><input size="18" type="text" name="receipt_address" value="<?php echo set_value('receipt_address'); ?>"></td>
            </tr>
            <tr>
              <td><?php echo $this->lang->line('city');?>(*)</td>
              <td><input size="18" type="text" name="receipt_city" value="<?php echo set_value('receipt_city'); ?>"></td>
            </tr>
            <tr>
              <td><?php echo $this->lang->line('country');?>(*)</td>
              <td><input size="18" type="text" name="receipt_country" value="<?php echo set_value('receipt_country'); ?>"></td>
            </tr>
            <tr>
              <td><?php echo $this->lang->line('zip_code');?>(*)</td>
              <td><input size="18" type="text" name="receipt_zip_code" value="<?php echo set_value('receipt_zip_code'); ?>"></td>
            </tr>
            <tr>
              <td><?php echo $this->lang->line('tc_identity');?></td>
              <td><input size="18" type="text" name="receipt_tc_number" id="tcno_format_inv" value="<?php echo set_value('receipt_tc_number'); ?>"></td>
            </tr>
          </table>
        </div>
        <div>
          <table id="receipt_table"  border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><?php echo $this->lang->line('is_company');?></td>
              <td><input type="checkbox" name="receipt_is_company" value="1" <?php echo set_checkbox('receipt_is_company','1'); ?>></td>
            </tr>
            <tr>
              <td><?php echo $this->lang->line('company_name');?></td>
              <td><input size="17" type="text" name="receipt_company_name" value="<?php echo set_value('receipt_company_name'); ?>"></td>
            </tr>
            <tr>
              <td><?php echo $this->lang->line('tax_dapartment');?></td>
              <td><input size="17" type="text" name="receipt_tax_department" value="<?php echo set_value('receipt_tax_department'); ?>"></td>
            </tr>
            <tr>
              <td><?php echo $this->lang->line('tax_number');?></td>
              <td><input size="17" type="text" name="receipt_tax_number" value="<?php echo set_value('receipt_tax_number'); ?>"></td><br>
            </tr>
          </table>
        </div>
      </div><br>
	  </div>
	  <br/>
    <div  style="clear:both;" id="itinirary">
		<div class="showBox">
		<h5><?php echo $this->lang->line('itinirary');?></h5><br>
		<div id="passengerSum">
		 <?php if ($this->session->userdata('search_form_adults') > 0) {
                    echo $this->session->userdata('search_form_adults') .' '. $this->lang->line('adult');
                } ?> <?php if ($this->session->userdata('search_form_children') > 0) {
                    echo '| ' . $this->session->userdata('search_form_children') .' '. $this->lang->line('child');
                } ?> <?php if ($this->session->userdata('search_form_infants') > 0) {
                    echo '| ' . $this->session->userdata('search_form_infants') .' '. $this->lang->line('infant');
                } ?> <?php if ($this->session->userdata('search_form_students') > 0) {
                    echo '| ' . $this->session->userdata('search_form_students') .' '. $this->lang->line('student');
                } ?> <?php if ($this->session->userdata('search_form_elders') > 0) {
                    echo '| ' . $this->session->userdata('search_form_elders') .' '. $this->lang->line('elder');
                } ?> <?php if ($this->session->userdata('search_form_military') > 0) {
                    echo '| ' . $this->session->userdata('search_form_military') .' '. $this->lang->line('military');
                } ?>
                 <p>
		</div>
		<div style="margin-left: -14px; padding-top:6px;">
		<table class="tb_available" style="width:675px;">
			<thead>
			</thead>
			<tbody>
			<tr>
					<td class="miniTable"><?php echo $this->lang->line('flight');?></td>
					<td class="miniTable"><?php echo $this->lang->line('from');?></td>
					<td class="miniTable"><?php echo $this->lang->line('to');?></td>
					<td class="miniTable"><?php echo $this->lang->line('date');?></td>
				</tr>
			<?php
			$segments = $this->session->userdata('segment_data');
			foreach($segments as $segment) {?>
				<tr style=" ">
					<td class="miniTable2"><?php echo $segment['flightNumber'];?></td>
					<td class="miniTable2"><?php echo $segment['origin'];?></td>
					<td class="miniTable2"><?php echo $segment['destination'];?></td>
					<td class="miniTable2"><?php echo $segment['date'];?></td>
				</tr>
				<?php }?>
			</tbody>
		</table></div>
		</div>
	</div><br>
      
  	<div id="iRed"><br>
       <?php echo $this->lang->line('i_red');?> 
      	<input type="checkbox" name="read_understood" value="1" <?php echo set_checkbox('read_understood','1'); ?>>
      	<button name="submit" value="<?php echo $this->lang->line('buy_now');?>" type="submit"><?php echo $this->lang->line('buy_now');?></button>
      	<?php
			$flight_time = $this->session->userdata('first_flight_time');
			$time_pos = 0;
			if ($flight_time[2] == '-') {
				$time_pos = 3;
			}
			$now = time();
			$fdate = date("d-m-Y", strtotime($this->session->userdata('search_form_depart_on_ui'))) . ' ' . substr($flight_time, $time_pos, 2) . ':' . substr($flight_time, $time_pos + 2, 2) . ':00';
			$diff = strtotime($fdate) - $now;
			if ($diff > (48 * 60 * 60)) {
      	?>
      	<button name="submit" value="<?php echo $this->lang->line('book_now');?>" type="submit"><?php echo $this->lang->line('book_now');?></button>
      	<?php } else { 
      		echo '<br><br>48 Saatten az kalan uçuşlar için rezervasyon yapılmamaktadır.<br><br>';
      	}?>
    </div>
	</div>
</div>